//  收银台--结款管理
import request from '@/router/axios'

//  获取配镜单列表
/*
*  params {saleStatus}  配镜单状态 1--待付款
*/
export function fetchMatchingList(query) {
  return request({
    url: '/eims/sale/getPaySalePage',
    method: 'get',
    params: query
  })
}

//查询欠款销售单
export function getArrearsSaleInfo(query) {
  return request({
    url: '/eims/sale/getArrearsSaleInfo',
    method: 'get',
    params: query
  })
}

//  配镜单补交欠款
export function paymentArrears(obj) {
  return request({
    url: '/eims/sale/paySaleArrears',
    method: 'post',
    data: obj
  })
}

//  删除配镜单
export function delMatchingObj(id) {
  return request({
    url: '/eims/sale/'+id,
    method: 'delete'
  })
}

// 查询销售单详情
export function getSaleDetail(query) {
  return request({
    url: '/eims/saleDetail/getSaleDetailBySaleId',
    method: 'get',
    params: query
  })
}

//  配镜单缴费
export function paymentConduct(obj) {
  return request({
    url: '/eims/sale/paySale',
    method: 'post',
    data: obj
  })
}

//  根据储值卡号查询储值卡余额
export function getValueStoredCard(cardNum) {
  return request({
    url: '/eims/saveMoneyCard/getInfoByCardNum/' + cardNum,
    method: 'get',
  })
}

//	根据代金券号查询代金券信息
export function getValueVouchersNum(num) {
	return request({
	  url: '/eims/vouchers/getByVouchersNum/' + num,
	  method: 'get',
	})
}

// 分页查询待付款销售单
export function fetchWaitPayList(query){
	return request({
		url: '/eims/sale/getInfoStatusPaidInProgress',
		method: 'get',
		params: query
	})
}

// 待付款销售单结款
export function waitPayMentHandle(query){
  return request({
    url: '/eims/sale/solveSaleStatusPaidInProgress',
    method: 'get',
    params: query
  })
}
